//	--------------------------------------------------------------------
//	Copyright(C) 2006,2007 Zhao Yukun. All rights reserved.
//	This file is a part of the Xeres system.
//	Xeres 2007
//	Contact : xeres.engine@gmail.com
//	$(reservedInfo)
//	$(reservedDeclaration)
//	--------------------------------------------------------------------
///	@file	<XEditDesktop.cpp>
///	@path	~/src/editor/xedit/
///	@date	2008/08/29
///	@desc	.

#define _FULLAPI
#include "config/config.h"

#include "gui/xgui/XFrame.h"

#include "editor/xedit/XEditDesktop.h"

namespace xeres {

	IMPL_IOBJECT_CLASS( XEditDesktop );


	// XEditDesktop
	XEditDesktop::XEditDesktop( void )
		: m_mainFrm( NULL )
	{
		TRACE_INFO( _S("XEdit desktop created...") );
	}
	// ~XEditDesktop
	XEditDesktop::~XEditDesktop( void )
	{
	}
	// OnKeyInput
	HandleInput XEditDesktop::OnKeyInput( Updater& updater )
	{
		TRACE_ERROR( _S("XEditDesktop::OnKeyInput: No message is expected comes here.") );
		FATAL_ABORT( _S("Invalid message passing.") );
		return INPUT_UNHANDLED;
	}
	// OnMouseInput
	HandleInput XEditDesktop::OnMouseInput( Updater& updater )
	{
		TRACE_ERROR( _S("XEditDesktop::OnMouseInput: No message is expected comes here.") );
		FATAL_ABORT( _S("Invalid message passing.") );
		return INPUT_UNHANDLED;
	}
	// GetDesktopOrigin
	Pair<int> XEditDesktop::GetDesktopOrigin( void )
	{
		// never change
		return Pair<int>(0,0);
	}
	// GetDesktopArea
	Rect<int> XEditDesktop::GetDesktopArea( void )
	{
		XS_ASSERT( m_mainFrm != NULL );
		// never change
		HDC dc = ::GetDC( m_mainFrm );
		int width = ::GetDeviceCaps( dc , HORZRES );
		int height = ::GetDeviceCaps( dc , VERTRES );
		::ReleaseDC( m_mainFrm , dc );
		return Rect<int>(0,0,width,height);
	}
	// GetFocusArea
	Rect<int> XEditDesktop::GetFocusArea( void )
	{
		return GetDesktopArea();
	}
	// GetInputFocus
	RefWeak<IGuiComp> XEditDesktop::GetInputFocus( void )
	{
		return m_focusing;
	}
	// SetDesktopOrigin
	void XEditDesktop::SetDesktopOrigin( const Pair<int>& org )
	{
		TRACE_WARNING( _S("XEditDesktop::SetDesktopOrigin: XEdit desktop cannot be moved.") );
	}
	// SetDesktopSize
	void XEditDesktop::SetDesktopSize( const Pair<int>& size )
	{
		TRACE_WARNING( _S("XEditDesktop::SetDesktopOrigin: XEdit desktop has fixed size.") );
	}
	// Attach
	void XEditDesktop::Attach( RefWeak<XFrame> form )
	{

	}
	// Detach
	void XEditDesktop::Detach( RefWeak<XFrame> form )
	{

	}
	// ShowWindow
	void XEditDesktop::ShowWindow( RefWeak<XFrame> form , bool hide , bool animate )
	{

	}
	// PinWindow
	void XEditDesktop::PinWindow( RefWeak<XFrame> form , bool pin )
	{

	}
	// Tick
	void XEditDesktop::Tick( Updater& updater , float dTime )
	{

	}
	// Draw
	void XEditDesktop::Draw( Composition& composition )
	{

	}
	// ClearFocus
	void XEditDesktop::ClearFocus( Updater& updater )
	{

	}
	// GetFocusing
	RefWeak<IGuiComp> XEditDesktop::GetFocusing( void )
	{
		return m_focusing;
	}
	// EnterInputMode
	void XEditDesktop::EnterInputMode( RefWeak<IGuiComp> comp , Updater& updater )
	{

	}
	// GetInputMode
	bool XEditDesktop::GetInputMode( void )
	{
		return false;
	}
	// AddChild
	bool XEditDesktop::AddChild( RefWeak<IGuiComp> comp )
	{
		return false;
	}
	// DelChild
	bool XEditDesktop::DelChild( RefWeak<IGuiComp> comp )
	{
		return false;
	}
	// AddTickable
	void XEditDesktop::AddTickable( RefWeak<IGuiComp> comp )
	{

	}
	// DelTickable
	void XEditDesktop::DelTickable( RefWeak<IGuiComp> comp )
	{

	}
	// RequestFocus
	void XEditDesktop::RequestFocus( RefWeak<IGuiComp> comp , Updater& updater )
	{

	}
	// GetPosition
	Pair<int> XEditDesktop::GetPosition( void )
	{
		return Pair<int>(0,0);
	}
	// SetPosition
	bool XEditDesktop::SetPosition( const Pair<int>& pos )
	{
		return false;
	}
	// GetSize
	Pair<int> XEditDesktop::GetSize( void )
	{
		XS_ASSERT( m_mainFrm != NULL );
		// never change
		HDC dc = ::GetDC( m_mainFrm );
		int width = ::GetDeviceCaps( dc , HORZRES );
		int height = ::GetDeviceCaps( dc , VERTRES );
		::ReleaseDC( m_mainFrm , dc );
		return Pair<int>(width,height);
	}
	// SetSize
	bool XEditDesktop::SetSize( const Pair<int>& size )
	{
		return false;
	}
	// SetPlacement
	bool XEditDesktop::SetPlacement( const Rect<int>& placement )
	{
		return false;
	}
	// GetPlacement
	Rect<int> XEditDesktop::GetPlacement( void )
	{
		return GetDesktopArea();
	}
	// GetVisible
	bool XEditDesktop::GetVisible( void )
	{
		return true;
	}
	// SetVisible
	bool XEditDesktop::SetVisible( bool visible )
	{
		return false;
	}
	// GetEnable
	bool XEditDesktop::GetEnable( void )
	{
		return true;
	}
	// SetEnable
	bool XEditDesktop::SetEnable( bool enable )
	{
		return false;
	}
	// GetFocus
	bool XEditDesktop::GetFocus( void )
	{
		return true;
	}
	// SetFocus
	bool XEditDesktop::SetFocus( bool focus )
	{
		return false;
	}
	// HitTest
	bool XEditDesktop::HitTest( const Pair<int>& pt )
	{
		return true;
	}
} // namespace xeres
